<template>
  <div class="club_card">
    <div class="club_icon">
      <img
        :src="item.club_logo == 'club_logo' ? `/imgs/club/club_logo.png` : joinURL(settings.media_url, item.club_logo)"
        alt="" />
      <span class="badge" v-if="item.is_admin === 1 && item.is_creator === 0">{{ t('club_page_admin') }}</span>
      <span class="official" v-else-if="item.is_official === 1">{{ t('club_page_gf') }}</span>
      <span class="badge" v-else-if="item.is_creator === 1 && item.is_admin === 1">{{ t('club_page_cjz') }}</span>
    </div>
    <div class="club_info">
      <h3 class="club_name">{{ item.club_name }}</h3>
      <p class="club_id">ID: {{ item.club_id }}</p>
      <p class="club_desc">{{ item.club_intro }}</p>
    </div>
    <div class="club_action">
      <button class="club_btn" v-if="isTables">
        {{ t("club_page_zs", { number: item.table_count }) }}
      </button>
      <ImgT src="/imgs/club/arrow.png" :key="'arrow'" class="arrow" alt="" />
    </div>
  </div>
</template>

<script lang="ts" setup>
// import {  ref, defineProps } from 'vue';
import { joinURL } from '@/utils/publicMethods'

import { storeToRefs } from 'pinia';
import pinia from '@/store/index';
import { useI18n } from 'vue-i18n';
import { Page } from '@/store/page';
// const { lang } = storeToRefs(Page(pinia));;
const { t } = useI18n();
// import PKwebsocket from "@/lolo/Ws";
// import { NetPacket } from "@/netBase/NetPacket";

// import { showToast } from "@nutui/nutui";
// import { getSelfGameUrl } from '@/utils/useNetMethods';

const { settings } = storeToRefs(Page(pinia));

const props: any = defineProps({
  item: {
    type: Object,
    default: {},
  },
  isTables: {
    type: Boolean,
    default: false, // 设置默认值
  },
});

console.log('props.item', props.item)

// const playType: any = ref({
//   1: t('club_page_jd'),
//   2: t('club_page_dp'),
// })

// const gameClubIds: any = ref({
//   49: t('club_page_49'),
//   47: t('club_page_47'),
// })


</script>

<style scoped lang="scss">
.club_list {
  display: flex;
  flex-direction: column;
  gap: 10px;

  .club_card {
    width: 347px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-radius: 10px;
    padding: 10px;
    color: white;
    background: url(/imgs/club/add_club_bg.png) no-repeat;
    background-size: 100% 100%;

    .club_icon {
      position: relative;
      width: 48px;
      height: 48px;
      margin-right: 8px;

      img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
      }

      .badge {
        width: 48px;
        position: absolute;
        bottom: -5px;
        left: 0;
        border-radius: 0 0 8px 8px;
        font-size: 12px;
        text-align: center;
        color: white;
        background: rgba(0, 0, 0, 0.6);
      }

      .official {
        width: 27px;
        height: 14px;
        position: absolute;
        top: 0;
        left: 0;
        background: url(/imgs/club/badge.png) no-repeat;
        background-size: 100% 100%;
        color: #FFF;
        font-family: "PingFang SC";
        font-size: 10px;
        font-style: normal;
        font-weight: 500;
        line-height: 14px;
        text-align: center;
      }
    }

    .club_info {
      flex: 1;
      overflow: hidden;

      .club_name {
        font-size: 14px;
        font-weight: bold;
        margin: 2px 0 0 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .club_id,
      .club_desc {
        width: 190px;
        font-size: 12px;
        margin: 2px 0 0;
        font-family: PingFang SC;
        color: #AFB6BD;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }

    .club_action {
      display: flex;
      align-items: center;

      .club_btn {
        width: 40px;
        height: 20px;
        color: white;
        border: none;
        border-radius: 5px;
        font-size: 12px;
        line-height: 20px;
        background: #1DBA8B;
      }

      .arrow {
        width: 16px;
        height: 16px;
        margin-left: 10px;
        font-size: 18px;
        color: #FFFFFF;
      }
    }
  }
}
</style>